﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KAsFrame.Common.Dto
{
    public class ApiResult<T>
    {
        public bool Success { get; set; }
        public string StatusCode { get; set; }
        public string Message { get; set; }
        public T Data { get; set; }

        public static ApiResult<T> IsSuccess(string msg = "", T data = default, string code = "0")
        {
            return new ApiResult<T> { Success = true, StatusCode = code, Message = msg, Data = data };
        }
        public static ApiResult<T> IsError(string msg = "", T data = default, string code = "1")
        {
            return new ApiResult<T> { Success = false, StatusCode = code, Message = msg, Data = data };
        }
    }
}
